<!--p132例10.1-->
<!--由这个练习可以做一个计算器面板的练习-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        label{
            width: 100px;
            text-align: right;
            display: block;
            float: left;
        }
        section{
            width: 260px;
            text-align: center;
        }
    </style>

    <script>
        function calc(){
            var remit = document.myform.txtremit.value;
            var fee = remit*0.01;
            if(fee<2) fee=2;
            document.myform.txtfee.value=fee;
        }
    </script>

</head>
<body>
    <section>
        <form name="myform" action="" method="get">
            <p><label>汇款金额：</label><input type="text" name="txtremit"/></p>
            <p><label>手续费：</label><input type="text" name="txtfee" readonly/></p>
            <p><input type="button" value="确定" onclick="calc()"></p>
        </form>
    </section>
</body>
</html>